package com.huika.dealontop.control.nearby.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.huika.dealontop.R;
import com.huika.dealontop.control.base.BaseAda;
import com.huika.dealontop.support.domain.NearbyItemValuesBean;
import com.huika.dealontop.support.domain.NearbyListBean;
import com.huika.dealontop.support.domain.SortBean;

import java.util.ArrayList;
import java.util.List;

/**
 * 分类排序节点适配器
 */
public class NearbySortAdapter extends BaseAda<SortBean> {

    public NearbySortAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder vh = null;
        if (view == null) {
            view = mInflater.inflate(R.layout.item_list_home_selete_right, viewGroup, false);
            vh = new ViewHolder(view);
            view.setTag(vh);
        } else {
            vh = (ViewHolder) view.getTag();
        }
        SortBean sortBean = getItem(i);
        vh.tv_name.setText(sortBean.getSort_Name());
        //显示有子分类数据图标
        if (sortBean.isSelete) {
            //子分类有被选中
            vh.tv_name.setTextColor(mContext.getResources().getColor(R.color.color_word_yellow));
        } else {
            vh.tv_name.setTextColor(mContext.getResources().getColor(R.color.color_333333));
        }
        return view;
    }

    class ViewHolder {
        public TextView tv_name;

        public ViewHolder(View view) {
            tv_name = (TextView) view.findViewById(R.id.name);
        }
    }
}
